<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, minimum-scale=1, shrink-to-fit=no"
    />

    <title>Marcdown - Lightweight markdown viewer and editor</title>
    <meta name="description" content="Lightweight markdown viewer and editor" />
    <link rel="canonical" href="https://liyasthomas.github.io/marcdown/" />
    <link rel="icon" href="favicon.ico" />

    <meta itemprop="name" content="Marcdown" />
    <meta
      itemprop="description"
      content="Lightweight markdown viewer and editor"
    />
    <meta itemprop="image" content="icons/icon-192x192.png" />
    <!-- See https://goo.gl/OOhYW5 -->
    <link rel="manifest" href="manifest.json" />
    <!-- See https://goo.gl/qRE0vM -->
    <meta name="theme-color" content="#DAE5ED" />
    <!-- Add to homescreen for Chrome on Android. Fallback for manifest.json -->
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="application-name" content="Marcdown" />
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta
      name="apple-mobile-web-app-status-bar-style"
      content="black-translucent"
    />
    <meta name="apple-mobile-web-app-title" content="Marcdown" />
    <!-- Homescreen icons -->
    <link rel="apple-touch-icon" href="icons/icon-48x48.png" />
    <link rel="apple-touch-icon" sizes="72x72" href="icons/icon-72x72.png" />
    <link rel="apple-touch-icon" sizes="96x96" href="icons/icon-96x96.png" />
    <link
      rel="apple-touch-icon"
      sizes="144x144"
      href="icons/icon-144x144.png"
    />
    <link
      rel="apple-touch-icon"
      sizes="192x192"
      href="icons/icon-192x192.png"
    />
    <!-- Tile icon for Windows 8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="icons/icon-144x144.png" />
    <meta name="msapplication-TileColor" content="#DAE5ED" />
    <meta name="msapplication-tap-highlight" content="no" />
    <!-- OpenGraph -->
    <meta property="og:site_name" content="Marcdown" />
    <meta property="og:url" content="https://liyasthomas.github.io/marcdown/" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Marcdown" />
    <meta
      property="og:description"
      content="Lightweight markdown viewer and editor"
    />
    <meta property="og:image" content="icons/icon-144x144.png" />
    <!-- Twitter -->
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@liyasthomas" />
    <meta name="twitter:creator" content="@liyasthomas" />
    <meta
      name="twitter:url"
      content="https://liyasthomas.github.io/marcdown/"
    />
    <meta name="twitter:title" content="Marcdown" />
    <meta
      name="twitter:description"
      content="Lightweight markdown viewer and editor"
    />
    <meta name="twitter:image" content="icons/icon-144x144.png" />

    <!-- Web Fonts -->
    <link
      href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,700&display=swap"
      rel="stylesheet"
    />
    <link rel="stylesheet" href="index.css" />

    <script>
      if ("serviceWorker" in navigator) {
        window.addEventListener("load", function () {
          navigator.serviceWorker
            .register("sw.js")
            .then(function (registration) {
              console.log(
                "ServiceWorker registration successful with scope: ",
                registration.scope
              );
            })
            .catch(function (err) {
              console.log("ServiceWorker registration failed: ", err);
            });
        });
      }
    </script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML&delayStartupUntil=configured"></script>
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/styles/dracula.min.css"
    />
    <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/asvd/syncscroll/syncscroll.min.js"></script>
  </head>
  <body>
    <main role="main" class="container">
      <header>
        <div class="tools">
          <div>
            <a href="https://liyasthomas.github.io/marcdown">Marcdown</a>
            <button onclick="apply('bold')" title="Bold">B</button>
            <button onclick="apply('italic')" title="Italic"><i>I</i></button>
            <button onclick="apply('strike')" title="Strikethrough">
              <strike>S</strike>
            </button>
            <button onclick="apply('h1')" title="Header 1">H1</button>
            <button onclick="apply('h2')" title="Header 2">H2</button>
            <button onclick="apply('h3')" title="Header 3">H3</button>
            <button onclick="apply('ul')" title="Unordered list">●</button>
            <button onclick="apply('ol')" title="Ordered list">1.</button>
            <button onclick="apply('check')" title="Check list">✔</button>
            <button onclick="apply('bq')" title="Blockquote">””</button>
            <button onclick="apply('ic')" title="Inline code">I&lt;></button>
            <button onclick="apply('bc')" title="Block code">&lt;>B</button>
            <button onclick="apply('link')" title="Link">A</button>
            <button onclick="apply('image')" title="Image">I</button>
            <button onclick="apply('hr')" title="Horizontal rule">——</button>
            <button onclick="apply('table')" title="Table">⚏</button>
          </div>
          <div>
            <span>
              <label class="file" for="file">
                Open
                <input
                  id="file"
                  type="file"
                  accept=".txt,.text,.md,.markdown,.markdn,.mdown,.htm,.html,.svg"
                  onchange="openFile(event)"
                />
              </label>
            </span>
            <button type="button" onclick="download();" id="save" disabled>
              Save
            </button>
            🌗
            <label class="theme-switch" for="checkbox" title="Night mode">
              <input type="checkbox" id="checkbox" />
              <div class="slider round"></div>
            </label>
          </div>
        </div>
      </header>
      <section class="content">
        <div id="editor">
          <textarea
            class="syncscroll"
            name="sync"
            id="getm"
            placeholder="paste markdown here ✨"
            onkeyup="Preview.Update()"
            onmouseup="mouseUp()"
            autofocus
          ></textarea>
        </div>
        <div
          class="markdown syncscroll"
          name="sync"
          id="viewer"
          style="display: none;"
        ></div>
        <div class="markdown syncscroll" name="sync" id="buffer"></div>
      </section>
      <footer>
        <div class="tools">
          <div style="flex: 1 1 0;">
            <span id="lineno"></span>
            <span id="colno"></span>
          </div>
          <div class="preview">
            <button onclick="slide('nill')" title="Hide editor">←</button>
            <button onclick="slide('half')" title="Side by side">●</button>
            <button onclick="slide('full')" title="Hide viewer">→</button>
          </div>
          <div style="flex: 1 1 0; text-align: right;">
            <span id="charcount"></span>
            <span id="wordcount"></span>
            <span class="trigger">❓</span>
          </div>
        </div>
      </footer>
      <div class="modal">
        <div class="modal-content">
          <span class="close-button">✖</span>
          <h1>Marcdown</h1>
          <h3>
            👻 Lightweight markdown viewer and editor by
            <a href="https://github.com/liyasthomas">Liyas Thomas</a>
          </h3>
          <h3>
            <a href="https://github.com/liyasthomas/marcdown" target="_blank"
              ><img
                src="icons/github.svg"
                style="margin-right: 8px;"
                alt="GitHub"
              />GitHub</a
            >
            <button id="installPWA" onclick="installPWA()">
              <img src="icons/pwalogo.svg" alt="PWA" style="height: 16px;" />
            </button>
          </h3>
        </div>
      </div>
    </main>
    <script src="index.js"></script>
  </body>
</html>
